有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

在Java库Android Studio 1.0.1中找不到本地路径

我已经看到,在Android studio中,本地路径未被发现的bug非常常见。这里有几个关于堆栈溢出(herehere)的例子。然而,我的案例是独一无二的,因为我的案例并不是因为添加了两次支持库或xml格式不正确而导致的。我知道这一点,因为我可以删除对Java库项目的所有引用,它将在我的设备上运行。然而,一旦我取消注释代码行并将java库添加为依赖项,我就会再次收到错误

我有一个理论,为什么我会收到这个错误,但我希望听到其他人的观点,或者更好的是,一个解决方案! 以下是我的项目结构: http://i.stack.imgur.com/JkxDQ.png

但也许更重要的是,这是渗透文件夹中的libs文件夹:

http://i.stack.imgur.com/r9tSa.png

正如你所见,这个项目依赖于很多文件。运行项目时,我收到以下错误:

Gradle控制台:

    FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDexDebug'.
> com.安卓.ide.common.internal.LoggedErrorException: Failed to run command:
    /usr/local/Cellar/安卓-sdk/22.6.2/build-tools/21.1.2/dx --dex --output /Volumes/default/My stuff/Developer/安卓 studio/WindowRunner/app/build/intermediates/pre-dexed/debug/osmosis-68e393234faceebfb2923624b3ad140c0ee95f84.jar /Volumes/default/My stuff/Developer/安卓 studio/WindowRunner/osmosis/build/libs/osmosis.jar
  Error Code:
    1
  Output:

    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.安卓.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
        at com.安卓.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
        at com.安卓.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
        at com.安卓.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
        at com.安卓.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
        at com.安卓.dx.command.dexer.Main.processClass(Main.java:704)
        at com.安卓.dx.command.dexer.Main.processFileBytes(Main.java:673)
        at com.安卓.dx.command.dexer.Main.access$300(Main.java:83)
        at com.安卓.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
        at com.安卓.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
        at com.安卓.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
        at com.安卓.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
        at com.安卓.dx.command.dexer.Main.processOne(Main.java:632)
        at com.安卓.dx.command.dexer.Main.processAllFiles(Main.java:510)
        at com.安卓.dx.command.dexer.Main.runMonoDex(Main.java:280)
        at com.安卓.dx.command.dexer.Main.run(Main.java:246)
        at com.安卓.dx.command.dexer.Main.main(Main.java:215)
        at com.安卓.dx.command.Main.main(Main.java:106)
    ...while parsing common/MyNode.class

    1 error; aborting


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED



Total time: 4.38 secs

亚行:

    Waiting for device.
Target device: lge-nexus_5-095034570b96f962
Uploading file
    local path: /Volumes/default/My stuff/Developer/安卓 studio/WindowRunner/app/build/outputs/apk/app-debug.apk
    remote path: /data/local/tmp/com.example.mattboyle.windowrunner
Local path doesn't exist.

我认为这句话引发了问题:

Failed to run command:
        /usr/local/Cellar/安卓-sdk/22.6.2/build-tools/21.1.2/dx --dex --output /Volumes/default/My stuff/Developer/安卓 studio/WindowRunner/app/build/intermediates/pre-dexed/debug/osmosis-68e393234faceebfb2923624b3ad140c0ee95f84.jar /Volumes/default/My stuff/Developer/安卓 studio/WindowRunner/osmosis/build/libs/osmosis.jar

因为在我的图书馆里没有渗透这种东西。罐子

我不确定构建的dex阶段做了什么,但希望能得到一些关于如何解决这个问题的建议

设置。格雷德尔:

include ':app', ':osmosis'

建造。格拉德尔(主)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.安卓.tools.build:gradle:1.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

建造。gradle(应用程序)

apply plugin: 'com.安卓.application'

安卓 {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.example.mattboyle.windowrunner"
        minSdkVersion 21
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-安卓.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.安卓.gms:play-services:6.5.87'
    compile project(':osmosis')
}

建造。格拉德尔(渗透)

    apply plugin: 'java'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

共 (0) 个答案